package com.example.shushiyunsst.fragment.main.home.recycler.view;




import android.util.SparseArray;

import com.example.shushiyunsst.fragment.main.home.recycler.bean.advise_bean.AdviseVideoEntity;


public class PageListPlayManager {

    private static class PageListPlayManagerHolder {
        private static final PageListPlayManager HOLDER = new PageListPlayManager();
    }

    public static PageListPlayManager getInstance() {
        return PageListPlayManagerHolder.HOLDER;
    }

    private PageListPlayManager() {

    }
    private boolean isPauseByInActive;

    private boolean isStartedPaying=false;


    private SparseArray<String> urls = new SparseArray<>();

    private AdviseVideoView player_view = null;

    private AdviseVideoEntity currentItem;

    public void setCurrentItem(AdviseVideoEntity currentItem) {
        this.currentItem = currentItem;
    }

    public AdviseVideoEntity getCurrentItem() {
        return currentItem;
    }

    public void release() {
        if (player_view != null) {
            player_view.onStop();
        }
    }

    public boolean isPauseByInActive() {
        return isPauseByInActive;
    }

    public void setPauseByInActive(boolean pauseByInActive) {
        isPauseByInActive = pauseByInActive;
    }

    public String getUrl(int pos) {
        return urls.get(pos);
    }

    public void saveUrl(int pos, String url) {
          urls.put(pos, url);
    }

    public AdviseVideoView getCurrentPayer() {
        return player_view;
    }

    public void setCurrentPayer(AdviseVideoView PLAYER_VIEW) {
        this.player_view = PLAYER_VIEW;
    }

    public boolean isStartedPaying() {
        return isStartedPaying;
    }

    public void setStartedPaying(boolean startedPaying) {
        isStartedPaying = startedPaying;
    }
}
